import java.util.Scanner;

public class Person1 {
		private String name;
		private int age;
		private boolean gender;
		private int id;
		static int ids;
		
	public Person1(){
		System.out.println("This is constructor");
		System.out.printf("%s,%d,%s,%d\n",name,age,gender,id);
	}
	public Person1(String name,int age,boolean gender){
		this.name=name;
		this.gender=gender;
		this.age =age;
	}
	
	public String toString() {
		return "Person [name=" + name + ", age=" + age + ", gender=" + gender + ", id=" + id + "]";
	}
	
	static{
		System.out.println("This is static initialization block");
	}
	{
		System.out.printf("This is initialization block, id is %d\n",ids);
	}
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=Integer.parseInt(sc.nextLine());
		Person1[] Persons = new Person1[n];
		for(int i=0;i<n;i++){
			Person1 person = new Person1(sc.next(),sc.nextInt(),sc.nextBoolean());
			Persons[i]=person;
			Persons[i].id=i; 
			ids=i+1;
		}
		for(int j=Persons.length-1;j>=0;j--){
			System.out.println(Persons[j].toString());
		}
		Person1 person2=new Person1();
		person2.id=ids;
		System.out.println(person2);

	}

}
